<script setup lang="ts">
import { computed } from 'vue'
import { ElTooltip } from 'element-plus'
import Success from '@/assets/images/step_sm_success.png'

import Waiting from '@/assets/images/step_sm_processing.png'
import Fail from '@/assets/images/step_sm_future.png'

const props = defineProps<{
  title: string
  time?: string
  content: string
  status: 'success' | 'waiting' | 'fail'
}>()

const icon = computed(() => {
  switch (props.status) {
    case 'waiting':
      return Waiting
    case 'success':
      return Success
    case 'fail':
      return Fail
  }
  return Fail
})

const content = computed(() => {
  switch (props.status) {
    case 'waiting':
      return '待审核'
    case 'success':
      return '审核通过'
    case 'fail':
      return '审核未通过'
  }
  return '审核未通过'
})
</script>

<template>
  <div class="step-item">
    <div class="step-item-title">
      <div class="step-item-icon-box">
        <ElTooltip :content="content">
          <img class="step-item-icon" :src="icon" alt="">
        </ElTooltip>
      </div>

      <span class="step-title">{{ title }}</span>
    </div>
    <div class="step-item-content">
      <span class="step-time">{{ time }}</span>
      <span class="step-content">{{ content }}</span>
    </div>
  </div>
</template>

<style scoped lang="scss">
.step-item {
  width: 8rem;
  display: flex;
  flex-direction: column;

  .step-item-title {
    position: relative;
    padding: 0 1rem 0 2.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, .2);

    .step-title {
      display: flex;
      font-size: 13px;
      color: #24292B;
      font-weight: bold;
      padding-bottom: 8px;
    }
    .step-item-icon-box {
      position: absolute;
      left: 0;
      bottom: -1rem;
      width: fit-content;
      height: fit-content;
    }
    .step-item-icon {

      height: 2rem;
      width: 2rem;
    }
  }

  .step-item-content {
    padding: 0 1rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    min-height: 1.5rem;

    .step-time {
      padding-top: 4px;
      font-size: 12px;
      color: #77909D;
    }
    .step-content {
      padding-top: 4px;
      font-size: 14px;
    }
  }
}
</style>
